<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>

<!--修改流程人员弹窗  -->
<div  class="content-warp">
    <div class="distribPersonel" id="updateUserPageBox" style="padding: 20px 20px">
        <form action="" id="updateUserForm" >
            <div class="table-warp">
                <table  class="cell-border crm-table columnsHidden dataTable" id="orderTable">
                <c:if test="${isShow eq false}">
                    <input name="subOrderIds" type="hidden" value="${productOrder.id}">
                    <tr>
                        <th ><span>生产单编号：</span></th>
                        <td>${productOrder.scProductOrderNo}</td>
                    </tr>
                    <tr>
                        <th ><span>合同编号：</span></th>
                        <td>${productOrder.contractNo}</td>
                    </tr>
                    <tr>
                        <th ><span>当前流程人员：</span></th>
                        <td>${productOrder.flowUserName}</td>
                    </tr>
                </c:if>
                <c:if test="${isShow eq true}">
                    <tr style="text-align: center">
                        <td><b>序号</b></td>
                        <td><b>生产单编号</b></td>
                        <td><b>合同编号</b></td>
                        <td><b>流程人员</b></td>
                        <td><b>操作</b></td>
                    </tr>
                    <c:forEach items="${orderList}" var="order" varStatus="status">
                        <tr style="text-align: center">
                            <td>${status.index + 1}</td>
                            <td>${order.scProductOrderNo}<input name="subOrderIds" type="hidden" value="${order.id}"></td>
                            <td>${order.contractNo}</td>
                            <td>${order.flowUserName}</td>
                            <td>
                                <a href="JavaScript:void(0);" class="layui-btn layui-btn-orange"
                                       onclick="removeOrder(this)">剔除</a>
                            </td>
                        </tr>
                    </c:forEach>
                </c:if>
                </table>
            </div>
            <div class="layui-inline">
                <label>流程人员：</label>
                <div class="layui-input-inline">
                    <select  id="flowUser" name="flowUser">
                        <option value="">--请选择--</option>
                    </select>
                </div>
            </div>
        </form>
    </div>
</div>
<script type="text/javascript">
    $(function(){
        //初始化分配人员选择
        chooseUserPlug.init($('#flowUser'),{
            url:sysInfo.basePath+'/zzsc/common/find_user_choose.do',
            otherParam:{
                type:'role',
                roleCode: 'ZZSC_FLOW_USER',
                locked:0
            }
        });
    });
</script>
<script type="text/javascript">
    function removeOrder(obj) {
        var num = $("#orderTable").children().children("tr").length;
        console.log(num);
        if(num == 2){
            DGG.Errors('请至少保留一个订单!');
            return;
        }
        $(obj).parent().parent().remove();
    }
</script>





